<div ng-init="init();" class="kmi-layout-content A08-content">
    <div class="kmi-header-row">
        <div class="brand-title">
            <div class="custom" ng-if="companyName">
                <div class="title" ng-bind="companyName"></div>
                <img src="" alt="" class="brand" />
                <div class="gap"></div>
            </div>
            <div class="digiwin">
                <img src="image/smes_v340/logo_ch.png" alt="" />
                <img src="image/smes_v340/logo_en.png" alt="" />
            </div>
        </div>
        <div class="header-title" ng-bind="'A08.title' | translate"></div>
        <div class="kmi-side-btn right-2" style="right: 91px; top: 25px;" ng-click="loadMyFavorites();">
            <img src=" image/smes_v340/W_Com_Love_nor_32.png" />
            <div class="kmi-can-click"></div>
        </div>
        <div class="kmi-side-btn right" style="right: 26px; top: 25px;" ng-click="loadSysSettings();">
            <img src=" image/smes_v340/W_Com_Setting_nor_32.png" />
            <div class="kmi-can-click"></div>
        </div>
        <div class="header-logo"></div>
    </div>
    <!-- 20201210 modify by 外包 for M#83236: 派工作业 - 增加流程卡列印 -->
    <div class="kmi-layout-main-content" ng-show="showMode == 'query' || showMode == 'preview'">
      
        <div class="kmi-layout-page">
            <div class="edit-mask" ng-show="(Mode == 'EditSendWork' || Mode == 'EditSeq' || Mode == 'Rollback')"></div>
            <div class="kmi-text-fields condition-panel" ng-class="{'hide-panel':Mode != '' && Mode != 'EditSendWork'}" >
                <label class="label" ng-bind="'A02.areaNo' | translate"></label>
                <input ng-model="selectareaName" readonly="readonly" ng-click="loadAreaList();"
                    ng-disabled="Mode != '' && Mode != 'EditSendWork'"></input>
                <div class="tip"><i class="material-icons">&#xE5CF;</i></div>
                <label class="label" style="padding-left:8px;" ng-bind="'A02.workStation' | translate"></label>
                <input ng-model="selectWorkStationName" readonly="readonly" ng-click="loadWorkStationList();" mdl-toast="{{selectWorkStationName}}"
                    ng-disabled="Mode != '' && Mode != 'EditSendWork'"></input>                
             <div class="kmi-text-fields" style="margin:0 0 2px 10px;">
                <label class="label" style="width: 30px; padding-right: 37px;" ng-bind="'A02.assigned_date' | translate"></label>
                <input ng-model="conditions.pack_date_start" ng-click="startDateChange()" ng-disabled="Mode != '' && Mode != 'EditSendWork'" mdl-date-min="conditions.pack_date_end"/>
             </div>
             <div class="kmi-text-fields">
                <label class="label" style="width: 30px; padding-right: 20px;" ng-bind="'B1402.queryList.end_time' | translate"></label>
                <input ng-model="conditions.pack_date_end" ng-click="endDateChange()" ng-disabled="Mode != '' && Mode != 'EditSendWork'" mdl-date-min="conditions.pack_date_start"/>
             </div>                                          
            </div>
            <div ng-show="showTipsFlag && moreInfoList.length > 0" id="popover_id" class="popover" style="left: 108px;display: block; visibility: visible;position: absolute; background-color: rgba(100,100,100,0.8) !important;color: #fff !important;padding: 6px 20px 6px 20px;z-index: 9999;border-radius: 6px; min-width:200px;">
                <div class="triangle-up" style="width: 0;height: 0;border-left: 15px solid transparent;border-right: 15px solid transparent;border-bottom: 10px solid rgba(100,100,100,0.8);position: absolute;top: -10px;left: 45%;"></div>
                <div class="popover-content">
                    <div ng-repeat="more in moreInfoList track by $index">
                        <div ng-bind="(more.fieldName?(more.fieldName+'：'):'')  + tempRow[more.fieldId]"></div>
                    </div>
                </div>
            </div>
            <!-- <div class="result-list"></div> -->
            <div class="conten-panel unwork-panel" style="position: relative;" ng-class="{'hide-panel':Mode != '' && Mode != 'EditSendWork'}">
                <div class="kmi-text-fields kmi-list__title">
                    <label class="label" ng-bind="'A02.unassigned' | translate"></label>
                    <label class="label" ng-bind="'A02.wo_no' | translate"></label>
                    <input ng-model="unassigned_wo_no"></input>
                    <label class="label" style="padding-left:8px;" ng-bind="'A02.plot_no' | translate"></label>
                    <input ng-model="unassigned_plot_no"></input>
                    <label class="label" style="padding-left:8px;" ng-bind="'B0225.status' | translate"></label>
                    <input ng-model="initPlotNoStatus" readonly="readonly" class="plotNoStatus" ng-click="getPlotNoStatas();" mdl-toast="{{initPlotNoStatus}}"
                        ng-disabled="Mode != '' && Mode != 'EditSendWork'"></input>
                    <div class="tip"><i class="material-icons">&#xE5CF;</i></div>
                    <label class="label" style="padding-left:8px;" ng-bind="'A10.is_urgent' | translate"></label>
                    <div class="check-point-switch" ng-class="{'is-selected':do_flag == 1}" ng-click="ClickDoFlag();">
                        <div style="width:24px;height:24px;"></div>
                    </div>
                    <div class="kmi-button kmi-button-confrim"  ng-click="unassigned_search()" style="width:100px">
                        <label ng-bind="'common.btn.search' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                    <div class="kmi-button kmi-button-cancel"  ng-click="unassigned_clear()" style="width:100px">
                        <label ng-bind="'common.btn.clear' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                </div>
                
                <!-- 20230616 modify by Alan for M#132192: 修正scrollbar位置 -->
                <div ng-include="dashboard.dispatch.templateUrl" style="height: calc(100% - 72px);z-index: 2;"></div>
           
                        <div class="page-content" style="position: absolute;bottom: 0;z-index: 3;width: 100%;">
                                <div class="page-icon">
                                    <img src="image/icons/dropleft.png"></img>
                                    <div class="kmi-can-click" ng-click="previous();"></div>
                                </div>
                                <label ng-bind="pageSetting.PageNumber + ' / ' + pageSetting.TotalPage"></label>
                                <div class="page-icon">
                                    <img src="image/icons/dropright.png"></img>
                                    <div class="kmi-can-click" ng-click="next();"></div>
                                </div>
                            <!-- 20230911 modify by Alan for#136071 : 增加跨頁選中功能 -->
                            <div class="selected-info">
                                <div class="current" ng-bind="SelectedInfo.current()"></div>
                                <div class="total" ng-bind="SelectedInfo.total()"></div>
                            </div>
                        </div>
               
              

                        <div class="kmi-text-fields" ng-class="{'expand_item': Mode === 'EditSendWork'}" style="position: absolute; right: 0px;">
                            <i class="material-icons close" ng-show="expandPage" ng-click="changeHeight()" style="padding: 8px; position: absolute; right: 2px; top: 2px;">remove</i>
                            <i class="material-icons open" ng-hide="expandPage" ng-click="changeHeight()" style="padding: 8px; position: absolute; right: 2px; top: 2px;">add</i>
                            <!--<img src="image/icons/upOrDown.png" ng-click="changeHeight()" alt="" style="position: absolute; right: 3px; top: 9px; width: 18px; height: 18px;">-->
                        </div>
                <!-- 20201210 modify by 外包 for M#83236: 派工作业 - 增加流程卡列印 -->
                <div class="kmi-layout-footer" ng-show="showMode == 'preview'">
                    <button class="mdl-button mdl-js-button mdl-button--fab mdl-shadow--custom mdl-button--custom1"
                    ng-click="preview();">
                        <img src="image/icons/print.png"></img>
                    </button>
                </div>
                <img src="image/icons/modelA_s.png" alt="">
            </div>
            
            <div ng-show="dispatchedShowTipsFlag && dispatchedMoreInfoList.length > 0" id="popover_id_wait" class="popover" style="left: 108px;display: block; visibility: visible;position: absolute; background-color: rgba(100,100,100,0.8) !important;color: #fff !important;padding: 6px 20px 6px 20px;z-index: 9999;border-radius: 6px; min-width:200px;">
                <div class="triangle-up" style="width: 0;height: 0;border-left: 15px solid transparent;border-right: 15px solid transparent;border-bottom: 10px solid rgba(100,100,100,0.8);position: absolute;top: -10px;left: 45%;"></div>
                <div class="popover-content">
                    <div ng-repeat="more in dispatchedMoreInfoList track by $index">
                        <div ng-bind="(more.fieldName?(more.fieldName+'：'):'')  + dispatchedTempRow[more.fieldId]"></div>
                    </div>
                </div>
            </div>
            <div class="conten-panel machine-panel" ng-class="{'hide-panel':Mode != '' && Mode != 'EditSendWork','expandPage':expandPage}" style="margin-top: 12px; position: relative; flex: 0 0 274px; overflow-y: auto;">
                <img src="image/icons/detail.png" ng-click="showExeclTable()"  alt="" style="position: absolute; right: 3px; top: 9px; width: 19px; height: 19px;z-index: 2;">

                <div class="kmi-text-fields kmi-list__title">
                    <label class="label" ng-bind="'A02.assigned' | translate"></label>
                    <label class="label" ng-bind="'A02.wo_no' | translate"></label>
                    <input ng-model="assigned_wo_no"></input>
                    <label class="label" style="padding-left:8px;" ng-bind="'A02.plot_no' | translate"></label>
                    <input ng-model="assigned_plot_no"></input>
                    <!-- 20200319 modify by WeiTing for M#62127 - 增加過濾已派工的設備編號或設備名稱。 -->
                    <label class="label" style="padding-left:8px;" ng-bind="'A02.machine' | translate"></label>
                    <input ng-model="assigned_machine"></input>
                    <div class="kmi-text-fields" ng-class="{'sort_item': Mode === 'EditSendWork'}" ng-show="Mode != 'EXCEL'">
                        <label class="label" style="padding:8px 0 0 8px;" ng-bind="'A02.equipment_sort' | translate"></label>
                        <!-- ng-disabled="Mode != '' && Mode != 'EditSendWork'" -->
                        <input readonly="readonly" style="margin-top: 8px;" ng-model="equipment_sort_mode_label" ng-click="getEquipmentSortModeList()"  ></input>
                        <div class="tip"><i class="material-icons">&#xE5CF;</i></div>
                    </div>
                    <div class="kmi-button kmi-button-confrim"  ng-click="assigned_search()" style="width:100px">
                        <label ng-bind="'common.btn.search' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                    <div class="kmi-button kmi-button-cancel"  ng-click="assigned_clear()" style="width:100px">
                        <label ng-bind="'common.btn.clear' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                </div>
                <div class="machine-list content" style="height:290px;overflow: hidden;overflow-y: auto;">                      
                        <!--ng-class="[mlightColor(item.load_status)]"-->
                        <div class="machine-contener" style="align-items: center;" ng-repeat="items in getMachineList() track by $index" ng-style="{'flex': deviceHeight?'0 0 (50% - 10px)': '0 0 (75% - 10px)'}">
                            <div style="display: flex; width: 100%; align-items: center; padding-bottom: 2px;">
                             <div>
                                <div ng-if="$index==0" style="margin-top: 20px;"></div>
                                <span style="font-size: 12px;display: flex;align-items:center;padding:0 6px;word-break: break-all;width: 100px;overflow: hidden;">{{items.machine_no}}</span> 
                                <span style="font-size: 12px; display: flex; align-items: center; padding: 0 6px; word-break: break-all; width: 100px; overflow: hidden; white-space: nowrap;">{{items.machine_name}}</span> 
                             </div>
                                                       
                             <div ng-repeat="item in items.lst_ORM_EquipmentPeriodModel track by $index;" style="flex: 1;white-space: nowrap;">
                               <div style="font-size: 12px; text-align: center;" ng-if="$parent.$index==0">{{(item.work_date.split("-"))[1]+'/'+(item.work_date.split("-"))[2]}}{{'('+ getWeek(item.work_date)+')'}}</div>
                               <div class="machine-conten" ng-class="[mlightColor(item.load_status)]" ng-style="cellStyle(item);">
                                 <!-- 20230523 modify by 15016 for M#0132192: 多日派工功能优化（设备显示、派工校验） -->
                                 <!--<div class="machine-title" style="padding-top: 3px; padding-bottom:2px;" ng-bind="('A02.mlist.column4'|translate)+item.machine_load + '%'"></div>-->
                                 <div class="machine-title"></div>
                                 <div class="machine-title" ng-show="ht_tr_bool" style="padding-bottom:6px;" ng-bind="('A02.mlist.column6'|translate) + item.furnace_qty + '/' + item.furnace_total_qty"></div>
                                 <!-- 20230523 modify by 15016 for M#0132192: 多日派工功能优化（设备显示、派工校验） -->
                                 <div class="machine-info" style="padding-top: 4px; padding-bottom: 3px; overflow: hidden; max-width: 166px; text-overflow: ellipsis;" ng-bind="('A02.mlist.column7'|translate) +item.used_capacity_show + '/' + item.capacity_show + 'H ' + item.machine_load + '%'"></div>
                                 <div ng-show="!ht_tr_bool" style="margin-bottom:17px;"></div>
                                 <!--<div class="machine-info" ng-bind="('A02.mlist.column3'|translate)+item.used_capacity_show+ 'HR'" style="padding-bottom:3px;"></div>-->
                                 <!--<div class="machine-info" ng-bind="('A02.mlist.column4'|translate)+item.machine_load + '%'"></div>-->
                                 <div class="machine-state" ng-if="item.work_date == currentDate">
                                    <!-- 20230620 modify by Alan for M#0132192: 修正設備狀態 -->
                                    <div class="machine-state-info" ng-class="[machineStatus(items.equipment_state_show)]" ng-bind="machineStatusDisplay(items.equipment_state_show)"></div>
                                 </div>
                                <div class="kmi-can-click" ng-click="machineSelect($index, item,items,$parent.$index, $event);"></div>
                               </div>    
                             </div>
                          </div>                                                        
                    </div>                   
                    <!--<div class="page-content" style="border: 0px;">
                        <div class="page-icon">
                            <img src="image/icons/dropleft.png"></img>
                            <div class="kmi-can-click"  ng-click="prevPage();"></div>
                        </div>
                        <label ng-bind="pageInfo.nowPage+' / '+pageInfo.totlePage"></label>
                        <div class="page-icon">
                            <img src="image/icons/dropright.png"></img>
                            <div class="kmi-can-click"  ng-click="nextPage();"></div>
                        </div>
                    </div>-->
                </div>
                 <!-- 20220319 modify by shiwl for M#62127 - 已派Excel列表 -->
                 
            </div>
            <div class="conten-panel work-panel" ng-class="{'hide-panel':Mode == '' ||(Mode == 'EditSendWork' || Mode == 'EXCEL') }" style="-index: 1; border-top: 0px; border-radius: 0 0 4px 4px;">
                <div class="kmi-text-fields" style="padding:0 4px 0 8px;">
                    <label class="label" ng-bind="'A02.mlist.column1'|translate"></label>
                    <label class="value" ng-bind="selectMachine.machine_no+' ('+selectMachine.machine_name+')'"></label>
                    <label class="label" ng-bind="'A02.mlist.column2'|translate"></label>
                    <label class="value" style="flex: 0 0 80px;" ng-bind="selectMachine.capacity_show + 'HR'"></label>
                    <label class="label" ng-bind="'A02.mlist.column3'|translate"></label>
                    <label class="value" style="flex: 0 0 80px;" ng-bind="selectMachine.used_capacity_show + 'HR'"></label>
                    <label class="label" ng-bind="'A02.mlist.column4'|translate"></label>
                    <label class="value" style="flex: 0 0 80px;" ng-bind="selectMachine.machine_load + '%'"></label>
                    <label class="label" ng-bind="'A02.mlist.column5'|translate"></label>
                    <div class="dashboard-light-panel" ng-class="[mlightColor(selectMachine.load_status)]"></div>
                </div>
                <div ng-include="dashboard.dispatched.templateUrl" style="overflow-y: auto; height: 100%;"></div>
                <div class="kmi-list__page-content" ng-show="Mode == 'MachineExpend'">
                    <div class="kmi-button kmi-button-cancel"  ng-click="closeMachine();" style="width:100px">
                        <label ng-bind="'common.btn.close' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                </div>
                <div class="kmi-list__page-content" ng-show="Mode == 'EditSeq'">
                    <div class="kmi-button kmi-button-confrim" ng-click="confirmEditSeq();" style="width:100px">
                        <label ng-bind="'A02.btn.confirm' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                    <div class="kmi-button kmi-button-cancel" ng-click="cancelEditSeq();" style="width:100px">
                        <label ng-bind="'A02.btn.cancel' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                </div>
                <div class="kmi-list__page-content"  ng-show="Mode == 'Rollback'">
                    <!-- 20201210 modify by 外包 for M#83236: 派工作业 - 增加流程卡列印 -->
                    <div class="kmi-button kmi-button-confrim" ng-click="preview();" style="width:100px">
                        <label ng-bind="'A02.btn.print' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                    <div class="kmi-button kmi-button-confrim" ng-click="confirmBatchMerge();" style="width:100px">
                        <label ng-bind="'A02.btn.batchMerge' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                    <div class="kmi-button kmi-button-confrim" ng-click="confirmTransfer();" style="width:100px" ng-if="selectRollback == 1">
                        <label ng-bind="'A02.btn.transfer' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                    <div class="kmi-button kmi-button-confrim" ng-click="confirmRollback();" style="width:100px">
                        <label ng-bind="'A02.btn.rollback' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                    <div class="kmi-button kmi-button-cancel"  ng-click="cancelRollback();" style="width:100px">
                        <label ng-bind="'A02.btn.cancel' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                </div>
            </div>
              <!-- 20220319 modify by shiwl for M#62127 - 已派Excel列表 -->
            <!-- 20230911 modify by Alan for#136071 : 修正勾選狀態跳出已派列表的問題 -->
            <div class="conten-panel work-panel" ng-class="{'hide-panel':Mode == '' || Mode == 'EditSendWork' || pageStyle == 'EXCEL'}" style="z-index: 1; border-top: 0px; border-radius: 0 0 4px 4px;">
                <!--<div class="kmi-text-fields" style="padding:0 4px 0 8px;">
                        <div class="kmi-button kmi-button-confrim"  ng-click="excelSave()" style="width:100px">
                                <label ng-bind="'common.btn.search' | translate"></label>
                                <div class="kmi-can-click"></div>
                         </div>
                     <label class="label" ng-bind="'A02.mlist.column1'|translate"></label>
                    <label class="value" ng-bind="selectMachine.machine_no+' ('+selectMachine.machine_name+')'"></label>
                    <label class="label" ng-bind="'A02.mlist.column2'|translate"></label>
                    <label class="value" style="flex: 0 0 80px;" ng-bind="selectMachine.capacity_show + 'HR'"></label>
                    <label class="label" ng-bind="'A02.mlist.column3'|translate"></label>
                    <label class="value" style="flex: 0 0 80px;" ng-bind="selectMachine.used_capacity_show + 'HR'"></label>
                    <label class="label" ng-bind="'A02.mlist.column4'|translate"></label>
                    <label class="value" style="flex: 0 0 80px;" ng-bind="selectMachine.machine_load + '%'"></label>
                    <label class="label" ng-bind="'A02.mlist.column5'|translate"></label>
                    <div class="dashboard-light-panel" ng-class="[mlightColor(selectMachine.load_status)]"></div> 
                </div>-->
                <div ng-include="dashboard.dispatched.templateUrl" style="overflow-y: auto; height: 100%;"></div>
                <div class="kmi-list__page-content" ng-show="Mode == 'MachineExpend'|| 'EXCEL'">
                    <div class="kmi-button kmi-button-cancel"  ng-click="closeMachine();" style="width:100px">
                        <label ng-bind="'common.btn.close' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                </div>
                <div class="kmi-list__page-content" ng-show="Mode == 'EditSeq'">
                    <div class="kmi-button kmi-button-confrim" ng-click="confirmEditSeq();" style="width:100px">
                        <label ng-bind="'A02.btn.confirm' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                    <div class="kmi-button kmi-button-cancel" ng-click="cancelEditSeq();" style="width:100px">
                        <label ng-bind="'A02.btn.cancel' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                </div>
                <div class="kmi-list__page-content"  ng-show="Mode == 'Rollback'">
                    <!-- 20201210 modify by 外包 for M#83236: 派工作业 - 增加流程卡列印 -->
                    <div class="kmi-button kmi-button-confrim" ng-click="preview();" style="width:100px">
                        <label ng-bind="'A02.btn.print' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                    <div class="kmi-button kmi-button-confrim" ng-click="confirmBatchMerge();" style="width:100px">
                        <label ng-bind="'A02.btn.batchMerge' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                    <div class="kmi-button kmi-button-confrim" ng-click="confirmTransfer();" style="width:100px" ng-if="selectRollback == 1">
                        <label ng-bind="'A02.btn.transfer' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                    <div class="kmi-button kmi-button-confrim" ng-click="confirmRollback();" style="width:100px">
                        <label ng-bind="'A02.btn.rollback' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                    <div class="kmi-button kmi-button-cancel"  ng-click="cancelRollback();" style="width:100px">
                        <label ng-bind="'A02.btn.cancel' | translate"></label>
                        <div class="kmi-can-click"></div>
                    </div>
                </div>
            </div>
           

          
        </div>
    </div>
    <!-- 20201210 modify by 外包 for M#83236: 派工作业 - 增加流程卡列印 -->
    <div class="kmi-layout-page" ng-show="showMode == 'print'" style="padding: 0;">
        <iframe id="kmi-pdf-panel" name="kmi-pdf-panel"></iframe>
    </div>
    <div class="kmi-layout-footer" ng-show="showMode == 'print'">
        <button class="mdl-button mdl-js-button mdl-button--fab mdl-shadow--custom mdl-button--custom1 sub"
        ng-click="print();">
          <img src="image/icons/print.png"></img>
        </button>
        <button class="mdl-button mdl-js-button mdl-button--fab mdl-shadow--custom mdl-button--custom1 sub"
        ng-click="download();">
          <img src="image/icons/download.png"></img>
        </button>
        <button class="mdl-button mdl-js-button mdl-button--fab mdl-shadow--custom mdl-button--custom1"
        ng-click="cancel();">
          <img src="image/icons/close.png"></img>
        </button>
    </div>
</div>
